/* eslint-disable @typescript-eslint/no-explicit-any */
import createApp from './main'

export default (ctx: any) => new Promise((resolve, reject) => {
  const { router, app } = createApp()
  router.push(ctx.url)
  router.onReady(() => {
    const matchedComponents = router.getMatchedComponents()
    if (!matchedComponents.length) {
      reject({ code: 404 })
    }
    resolve(app)
  }, reject)
})